package homework1;

public class StringReplace {

	public static void main(String[] args) {
		String m = "hello ?,nice+(book) ?-? good";
		String[] n = {" ","he","she"};
		
		//方法一：
		//String[] strs = m.split("\\?");
		/*String s1 = strs[0]+n[0];
		String s2 = strs[1]+n[1];
		String s3 = strs[2]+n[2];
		String finalStr = s1+s2+s3+strs[3];
		System.out.println(finalStr);*/
		
		// 方法二：
		String m1 = m.replaceFirst("\\?", n[0]);
		String m2 = m1.replaceFirst("\\?", n[1]);
		String m3 = m2.replaceFirst("\\?", n[2]);
		System.out.println(m3);
	}

}
